/**
 * 
 */
package org.vsg.stock.core.persistence;

import java.util.Collection;
import java.util.Date;
import java.util.List;

import org.springframework.dao.DataAccessException;
import org.vsg.stock.core.domain.StockDailyKLine;

/**
 * @author Bill Vison
 *
 */
public interface StockDailyKLineDao {
	
	/**
	 * 
	 * @param entities
	 * @throws DataAccessException
	 */
	void saveAll(Collection<StockDailyKLine> entities) throws DataAccessException;

	
	/**
	 * 
	 * @param code
	 * @param startDate
	 * @param endDate
	 * @return
	 * @throws DataAccessException
	 */
	List<StockDailyKLine> findStockLineByCycle(String code , Date startDate , Date endDate) throws DataAccessException;
	
	
	
	/**
	 * 
	 * @param code
	 * @return
	 * @throws DataAccessException
	 */
	List<StockDailyKLine> findStockLineByAll(String code) throws DataAccessException;
	
	/**
	 * 
	 * @param startDate
	 * @param endDate
	 * @return
	 * @throws DataAccessException
	 */
	List<StockDailyKLine> findOverRatioLineByInCycle(Date startDate , Date endDate, double ratio) throws DataAccessException;

	/**
	 * 
	 * @param refDate
	 * @param ratio
	 * @return
	 * @throws DataAccessException
	 */
	List<StockDailyKLine> findStockLineByOverRatio(Date refDate , double ratio) throws DataAccessException;
	
	/**
	 * 
	 * @param stockCode
	 * @param fromDate
	 * @param cycle
	 * @return
	 * @throws DataAccessException
	 */
	long findMinVolInCycle(String stockCode , Date fromDate , int cycle) throws DataAccessException;
	
	/**
	 * 
	 * @param stockCode
	 * @param vol
	 * @param fromDate
	 * @param cycle
	 * @return
	 * @throws DataAccessException
	 */
	StockDailyKLine getStkDailyLineByMinVolInCycle(String stockCode , long vol ,Date fromDate , int cycle) throws DataAccessException;
	
	/**
	 * 
	 * @param stockCode
	 * @param fromDate
	 * @param cycle
	 * @return
	 * @throws DataAccessException
	 */
	StockDailyKLine getStkDailyLineByMinVolInCycle(String stockCode , Date fromDate , int cycle) throws DataAccessException;
	
	/**
	 * 
	 * @param stockCode
	 * @param date
	 * @return
	 * @throws DataAccessException
	 */
	StockDailyKLine getDailyLineFromDate(String stockCode , Date date) throws DataAccessException;

	

	/**
	 * 
	 * @param stkCode
	 * @throws DataAccessException
	 */
	public void updateStockExRights(String stkCode) throws DataAccessException;
	
	/**
	 * 
	 * @param stkCode
	 * @param refDate
	 * @throws DataAccessException
	 */
	public void updateStockDateExRights(String stkCode , Date refDate) throws DataAccessException;
	

}
